home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / windows / diags100.zip / DIAGS.WAS
Text File  |  1992-10-13  |  18KB  |  338 lines

  1. ;Diags.Was   v1.00   Displays diagnostic files.
  2.  
  3. ;****************************************************************************
  4. ;*                                                                          *
  5. ;* DIAGS.WAS                                                                *
  6. ;* Copyright (C) 1992 Datastorm Technologies, Inc.                          *
  7. ;* All rights reserved                                                      *
  8. ;*                                                                          *
  9. ;* Purpose:  Displays diagnostic files for help in debugging problems.      *
  10. ;*                                                                          *
  11. ;* This ASPECT SCRIPT file adds an item to the Procomm Plus for Windows     *
  12. ;* menubar which says "View System" and is selectable from ALT-V.  When this*
  13. ;* new item is selected, a drop down box with five choices is displayed.    *
  14. ;* Four files can be viewed:  AUTOEXEC.BAT, CONFIG.SYS, WIN.INI, and        *
  15. ;* SYSTEM.INI.  The fifth choice is Quit to quit the program and erase the  *
  16. ;* option from your menubar.                                                *
  17. ;*                                                                          *
  18. ;* This ASPECT SCRIPT is intended only as a sample of ASPECT programming.   *
  19. ;* DATASTORM makes no warranty of any kind, express or implied, including   *
  20. ;* without limitation, any warranties of mechantability and/or fitness      *
  21. ;* for a particular purpose.  Use of this program is at your own risk.      *
  22. ;*                                                                          *
  23. ;* IMPORTANT!!  The global variables below need to be changed to match your *
  24. ;* locations for these files if they are different than listed.             *
  25. ;*                                                                          *
  26. ;* Author: Chris Brandow                                                    *
  27. ;*                                                                          *
  28. ;****************************************************************************
  29.  
  30. ;****************************************************************************
  31. ;*                                                                          *
  32. ;* GLOBAL VARIABLES                                                         *
  33. ;*                                                                          *
  34. ;* Don't forget to change these to match your system!!                      *
  35. ;*                                                                          *
  36. ;****************************************************************************
  37.  
  38. string AutoFile = "C:\AUTOEXEC.BAT"              ;change these to match
  39. string ConfigFile = "C:\CONFIG.SYS"              ;your system.
  40. string SysFile = "C:\WINDOWS\SYSTEM.INI"
  41. string WinFile = "C:\WINDOWS\WIN.INI"
  42. string PWFile = "C:\WINDOWS\PW.INI"
  43. ;****************************************************************************
  44. ;*                                                                          *
  45. ;* MAIN                                                                     *
  46. ;* The procedure Main calls the procedure Diags which does the menubar      *
  47. ;* addition and tests to see which menu item was selected.  Based on the    *
  48. ;* value of the item selected, the procedure for the appropriate selection  *
  49. ;* is called.                                                               *
  50. ;*                                                                          *
  51. ;* Calls: Diags                                                             *
  52. ;* Modifies globals: none                                                   *
  53. ;*                                                                          *
  54. ;****************************************************************************
  55.  
  56. proc Main
  57.  
  58.    set aspect spawn on                           ; Allow other scripts to run
  59.    Diags()
  60.    
  61. endproc
  62.  
  63. ;****************************************************************************
  64. ;*                                                                          *
  65. ;* DIAGS                                                                    *
  66. ;* The procedure Diags puts the menubar option on the existing PW menubar   *
  67. ;* and does nothing until the user wants to see one of the files available  *
  68. ;* through this option.  When the user selects View System, menuitems drop  *
  69. ;* down for the user to select.  When the user selects anything but the     *
  70. ;* Quit option, the respective file will be displayed in an editbox for the *
  71. ;* user to view it or change it.                                            *
  72. ;*                                                                          *
  73. ;* Calls: AutoDisplay, ConfigDisplay, SysDisplay, WinDisplay                *
  74. ;* Called by: Main                                                          *
  75. ;* Modifies globals: none                                                   *
  76. ;*                                                                          *
  77. ;****************************************************************************
  78.  
  79. proc Diags
  80. integer MenuID, DiagValue
  81.    
  82.    menupopup $PWMENUBAR "&View System" MenuID    ;starts the menubar add-ons.
  83.       menuitem MenuID 6 "&AUTOEXEC.BAT"          ;puts in menuitems below
  84.       menuitem MenuID 7 "&CONFIG.SYS"            ;the view system option.
  85.       menuitem MenuID 8 "&SYSTEM.INI"
  86.       menuitem MenuID 9 "&WIN.INI"
  87.       menuitem MenuID 10 "&PW.INI"
  88.       menuitem MenuID 11 "&QUIT"
  89.    showmenu $PWMENUBAR                           ;don't forget to showmenu!
  90.  
  91.    DiagValue = $MENU   
  92.  
  93.    while DiagValue != 11                         ;while Quit is not selected.
  94.       DiagValue = $MENU
  95.  
  96.       switch DiagValue                           ;switch to the item that was
  97.          case 6                                  ;chosen which will go to the
  98.             AutoDisplay()                        ;respective procedure.
  99.          endcase
  100.       
  101.          case 7
  102.             ConfigDisplay()
  103.          endcase
  104.       
  105.          case 8
  106.             SysDisplay()
  107.          endcase
  108.       
  109.          case 9
  110.             WinDisplay()
  111.          endcase
  112.       
  113.          case 10
  114.             PWDisplay()
  115.          endcase
  116.       endswitch
  117.    endwhile
  118. endproc   
  119.  
  120. ;****************************************************************************
  121. ;*                                                                          *
  122. ;* AUTODISPLAY                                                              *
  123. ;* The procedure AutoDisplay is called when the user wants to view their    *
  124. ;* AUTOEXEC.BAT file from the drop down menu items.  This procedure simply  *
  125. ;* displays the file that the user specifies in the global variable above.  *
  126. ;* The global variables should be changed if the user's files are in a      *
  127. ;* different location than specified.                                       *
  128. ;* Before the file is displayed, the attributes of the file are read and    *
  129. ;* stored.  The attributes are then set to nothing and the file is allowed  *
  130. ;* to be changed.  When the user is finished with the file, the attributes  *
  131. ;* are restored to the original settings.                                   *
  132. ;* There are two buttons at the bottom of the dialog box.  One is an OK     *
  133. ;* button which will save the file and exit the dialog box but not the      *
  134. ;* script.  The other is a Cancel pushbutton which will just exit the dialog*
  135. ;* box without saving the file.  !!!!If cancel is hit, all changes will be  *
  136. ;* lost!!!!                                                                 *
  137. ;*                                                                          *
  138. ;* Calls: nothing                                                           *
  139. ;* Called by: Diags                                                         *
  140. ;* Modifies globals: none                                                   *
  141. ;*                                                                          *
  142. ;****************************************************************************
  143.  
  144. proc AutoDisplay
  145. string AutoAttr, NoAttr = ""
  146. integer BoxValue
  147.  
  148.    getfattr AutoFile AutoAttr                    ;get attributes of file.
  149.    setfattr AutoFile NoAttr                      ;set attributes to null.
  150.    dialogbox 65 65 297 193 7 "AUTOEXEC.BAT"      ;display dialogbox.
  151.       feditbox 0 0 294 169 AutoFile
  152.       pushbutton 55 173 61 14 "&OK" normal
  153.       pushbutton 179 173 61 14 "&Cancel" cancel
  154.    enddialog
  155.  
  156.    BoxValue = $DIALOG
  157.  
  158.    while BoxValue != 1                           ;loop until cancel is hit.
  159.       BoxValue = $DIALOG                         ;read value of button hit.
  160.       if BoxValue == 10                          ;if OK was hit,
  161.          statmsg "Updating AUTOEXEC.BAT..."      ;display message on status,
  162.          destroydlg                              ;remove dialogbox,
  163.          pause 1                                 ;pause so user can read it,
  164.          statclear                               ;clear status line,
  165.          exitwhile                               ;and exit the while loop.
  166.       endif
  167.    endwhile
  168.    setfattr AutoFile AutoAttr                    ;put the attributes back.
  169. endproc
  170.  
  171. ;****************************************************************************
  172. ;*                                                                          *
  173. ;* CONFIGDISPLAY                                                            *
  174. ;* The procedure ConfigDisplay is called when the user wants to view their  *
  175. ;* CONFIG.SYS file from the drop down menu items.  This procedure simply    *
  176. ;* displays the file that the user specifies in the global variable above.  *
  177. ;* The global variables should be changed if the user's files are in a      *
  178. ;* different location than specified.                                       *
  179. ;*                                                                          *
  180. ;* Calls: nothing                                                           *
  181. ;* Called by: Diags                                                         *
  182. ;* Modifies globals: none                                                   *
  183. ;*                                                                          *
  184. ;****************************************************************************
  185.  
  186. proc ConfigDisplay
  187. string ConfigAttr, NoAttr = ""
  188. integer BoxValue
  189.  
  190.    getfattr ConfigFile ConfigAttr                ;get attributes of file.
  191.    setfattr ConfigFile NoAttr                    ;set attributes to null.
  192.    dialogbox 65 65 297 193 7 "CONFIG.SYS"        ;display dialogbox.
  193.       feditbox 0 0 294 169 ConfigFile
  194.       pushbutton 55 173 61 14 "&OK" normal
  195.       pushbutton 179 173 61 14 "&Cancel" cancel
  196.    enddialog
  197.  
  198.    BoxValue = $DIALOG
  199.  
  200.    while BoxValue != 1                           ;loop until cancel is hit.
  201.       BoxValue = $DIALOG                         ;read value of button hit.
  202.       if BoxValue == 10                          ;if OK was hit,
  203.          statmsg "Updating CONFIG.SYS..."        ;display message on status,
  204.          destroydlg                              ;remove dialogbox,
  205.          pause 1                                 ;pause so user can read it,
  206.          statclear                               ;clear status line,
  207.          exitwhile                               ;and exit the while loop.
  208.       endif
  209.    endwhile
  210.    setfattr ConfigFile ConfigAttr                ;put the attributes back.
  211. endproc
  212.  
  213. ;****************************************************************************
  214. ;*                                                                          *
  215. ;* SYSDISPLAY                                                               *
  216. ;* The procedure SysDisplay is called when the user wants to view their     *
  217. ;* SYSTEM.INI file from the drop down menu items.  This procedure simply    *
  218. ;* displays the file that the user specifies in the global variable above.  *
  219. ;* The global variables should be changed if the user's files are in a      *
  220. ;* different location than specified.                                       *
  221. ;*                                                                          *
  222. ;* Calls: nothing                                                           *
  223. ;* Called by: Diags                                                         *
  224. ;* Modifies globals: none                                                   *
  225. ;*                                                                          *
  226. ;****************************************************************************
  227.  
  228. proc SysDisplay
  229. string SysAttr, NoAttr = ""
  230. integer BoxValue
  231.    getfattr SysFile SysAttr                      ;get attributes of file.
  232.    setfattr SysFile NoAttr                       ;set attributes to null.
  233.    dialogbox 65 65 297 193 7 "SYSTEM.INI"        ;display dialogbox.
  234.       feditbox 0 0 294 169 SysFile
  235.       pushbutton 55 173 61 14 "&OK" normal
  236.       pushbutton 179 173 61 14 "&Cancel" cancel
  237.    enddialog
  238.  
  239.    BoxValue = $DIALOG
  240.  
  241.    while BoxValue != 1                           ;loop until cancel is hit.
  242.       BoxValue = $DIALOG                         ;read value of button hit.
  243.       if BoxValue == 10                          ;if OK was hit,
  244.          statmsg "Updating SYSTEM.INI..."        ;display message on status,
  245.          destroydlg                              ;remove dialogbox,
  246.          pause 1                                 ;pause so user can read it,
  247.          statclear                               ;clear status line,
  248.          exitwhile                               ;and exit the while loop.
  249.       endif
  250.    endwhile
  251.    setfattr SysFile SysAttr                      ;put the attributes back.
  252. endproc
  253.  
  254. ;****************************************************************************
  255. ;*                                                                          *
  256. ;* WINDISPLAY                                                               *
  257. ;* The procedure WinDisplay is called when the user wants to view their     *
  258. ;* WIN.INI file from the drop down menu items.  This procedure simply       *
  259. ;* displays the file that the user specifies in the global variable above.  *
  260. ;* The global variables should be changed if the user's files are in a      *
  261. ;* different location than specified.                                       *
  262. ;*                                                                          *
  263. ;* Calls: nothing                                                           *
  264. ;* Called by: Diags                                                         *
  265. ;* Modifies globals: none                                                   *
  266. ;*                                                                          *
  267. ;****************************************************************************
  268.  
  269. proc WinDisplay
  270. string WinAttr, NoAttr = ""
  271. integer BoxValue
  272.  
  273.    getfattr WinFile WinAttr                      ;get attributes of file.
  274.    setfattr WinFile NoAttr                       ;set attributes to null.
  275.    dialogbox 65 65 297 193 7 "WIN.INI"           ;display dialogbox.
  276.       feditbox 0 0 294 169 WinFile
  277.       pushbutton 55 173 61 14 "&OK" normal
  278.       pushbutton 179 173 61 14 "&Cancel" cancel
  279.    enddialog
  280.  
  281.    BoxValue = $DIALOG
  282.  
  283.    while BoxValue != 1                           ;loop until cancel is hit.
  284.       BoxValue = $DIALOG                         ;read value of button hit.
  285.       if BoxValue == 10                          ;if OK was hit,
  286.          statmsg "Updating WIN.INI..."           ;display message on status,
  287.          destroydlg                              ;remove dialogbox,
  288.          pause 1                                 ;pause so user can read it,
  289.          statclear                               ;clear status line,
  290.          exitwhile                               ;and exit the while loop.
  291.       endif
  292.    endwhile
  293.    setfattr WinFile WinAttr                      ;put the attributes back.
  294. endproc
  295.  
  296. ;****************************************************************************
  297. ;*                                                                          *
  298. ;* PWDISPLAY                                                                *
  299. ;* The procedure PWDisplay is called when the user wants to view their      *
  300. ;* PW.INI file from the drop down menu items.  This procedure simply        *
  301. ;* displays the file that the user specifies in the global variable above.  *
  302. ;* The global variables should be changed if the user's files are in a      *
  303. ;* different location than specified.                                       *
  304. ;*                                                                          *
  305. ;* Calls: nothing                                                           *
  306. ;* Called by: Diags                                                         *
  307. ;* Modifies globals: none                                                   *
  308. ;*                                                                          *
  309. ;****************************************************************************
  310.  
  311. proc PWDisplay
  312. string PWAttr, NoAttr = ""
  313. integer BoxValue
  314.  
  315.    getfattr PWFile PWAttr                        ;get attributes of file.
  316.    setfattr PWFile NoAttr                        ;set attributes to null.
  317.    dialogbox 65 65 297 193 7 "PW.INI"            ;display dialogbox.
  318.       feditbox 0 0 294 169 PWFile
  319.       pushbutton 55 173 61 14 "&OK" normal
  320.       pushbutton 179 173 61 14 "&Cancel" cancel
  321.    enddialog
  322.  
  323.    BoxValue = $DIALOG
  324.  
  325.    while BoxValue != 1                           ;loop until cancel is hit.
  326.       BoxValue = $DIALOG                         ;read value of button hit.
  327.       if BoxValue == 10                          ;if OK was hit,
  328.          statmsg "Updating PW.INI..."            ;display message on status,
  329.          destroydlg                              ;remove dialogbox,
  330.          pause 1                                 ;pause so user can read it,
  331.          statclear                               ;clear status line,
  332.          exitwhile                               ;and exit the while loop.
  333.       endif
  334.    endwhile
  335.    setfattr PWFile PWAttr                        ;put the attributes back.
  336. endproc
  337.  
  338.